package com.six.controller;

import com.six.domain.entity.Store;
import com.six.service.StoreService;
import com.six.util.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class StoreController {

    private final StoreService storeService;

    /* ====== 顾客端：拉取全部门店 ====== */
    @GetMapping("/stores")
    public Result<List<Store>> listAllStores() {
        return Result.success(storeService.listAllStores());
    }
    @GetMapping("/{id}")
    public Result<Store> getStore(@PathVariable Long id){
        return Result.success(storeService.getStore(id));
    }
}